<template>
	<view>
		  <u-tabs :list="subjects" :current="current" @change="tabchanged"  lineWidth="100px" style="width: 100%;" itemStyle="width:40%;padding-left: 10px; padding-right: 10px; height:40px"></u-tabs>
		  <view>
			  <view>
				  <view style="display: flex; justify-content:left; align-items: flex-start; flex-wrap: wrap;" >

					  <view v-for="(item,index) in list" style="padding: 5px 10px; position: relative;" :key="index" @click="handleClick(index,item)">
						  <view style=" border-radius: 5px;">
							  <image :src="item.cover" style="width: 100px; height: 130px;"></image>
							  <view style="text-align: center;">{{item.grade}} {{item.ceshu}}</view>
						  </view>
						    <view style="position: absolute; right: 10px;bottom:35px;z-index: 999;">
								
							</view>
					  </view>

				  </view>
			  </view>
		  </view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				current:0,
				subjects: [{
					name: "语文"
				}, {
					name: "英语"
				}],
				list:[
					{bookid:"c1a",subject:"语文",grade:"一年级",ceshu:"上册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c1a.jpg'},
					{bookid:"c1b",subject:"语文",grade:"一年级",ceshu:"上册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c1b.jpg'},
					{bookid:"c2a",subject:"语文",grade:"二年级",ceshu:"上册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c2a.jpg'},
					{bookid:"c2b",subject:"语文",grade:"二年级",ceshu:"下册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c2b.jpg'},
					{bookid:"c3a",subject:"语文",grade:"三年级",ceshu:"上册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c3a.jpg'},
					{bookid:"c3b",subject:"语文",grade:"三年级",ceshu:"下册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c3a.jpg'},
					{bookid:"c4a",subject:"语文",grade:"四年级",ceshu:"上册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c4a.jpg'},
					{bookid:"c4b",subject:"语文",grade:"四年级",ceshu:"下册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c4a.jpg'},
					{bookid:"c5a",subject:"语文",grade:"五年级",ceshu:"上册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c5a.jpg'},
					{bookid:"c5b",subject:"语文",grade:"五年级",ceshu:"下册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c5a.jpg'},
					{bookid:"c6a",subject:"语文",grade:"六年级",ceshu:"上册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c6a.jpg'},
					{bookid:"c6b",subject:"语文",grade:"六年级",ceshu:"下册",version:"统编版",checked:false,cover:'http://rc.metahike.com/bookcovers/tbb_c6a.jpg'},
					
				]
			}
		},
		methods: {
			tabchanged(item){
				this.current=item.index;
				console.log(item);
			},
			handleClick(index,item){
				console.log(index,item);
				uni.setStorageSync("curbook",item);
				uni.reLaunch({
					url:"/pages/index"
				})
			}
		}
	}
</script>

<style>

</style>